// dbghelp.dll dynamic import

#pragma once

// ----------------------------------------------------------------------------

#pragma warning(push)
#pragma warning(disable:4091)
#include <DbgHelp.h>
#pragma warning(pop)

// ----------------------------------------------------------------------------

namespace DSymLoad
{

// ----------------------------------------------------------------------------

class CDbgHelp
{
public:
    explicit CDbgHelp(const CStringA &csLibPath);
    ~CDbgHelp();

    typedef decltype(&::SymSetOptions) PtrSymSetOptions;
    PtrSymSetOptions GetSymSetOptions() const;

    typedef decltype(&::SymInitialize) PtrSymInitialize;
    PtrSymInitialize GetSymInitialize() const;

    typedef decltype(&::SymCleanup) PtrSymCleanup;
    PtrSymCleanup GetSymCleanup() const;

    typedef decltype(&::SymLoadModuleEx) PtrSymLoadModuleEx;
    PtrSymLoadModuleEx GetSymLoadModuleEx() const;

    typedef decltype(&::SymUnloadModule64) PtrSymUnloadModule64;
    PtrSymUnloadModule64 GetSymUnloadModule64() const;

    typedef decltype(&::SymEnumSymbols) PtrSymEnumSymbols;
    PtrSymEnumSymbols GetSymEnumSymbols() const;

    typedef decltype(&::SymGetModuleInfo64) PtrSymGetModuleInfo64;
    PtrSymGetModuleInfo64 GetSymGetModuleInfo64() const;

    typedef decltype(&::SymGetTypeInfo) PtrSymGetTypeInfo;
    PtrSymGetTypeInfo GetSymGetTypeInfo() const;

    static PCSTR GetLibraryFileName();

private:
    HMODULE m_hModule;

    PtrSymSetOptions m_pSymSetOptions;
    PtrSymInitialize m_pSymInitialize;
    PtrSymCleanup m_pSymCleanup;
    PtrSymLoadModuleEx m_pSymLoadModuleEx;
    PtrSymUnloadModule64 m_pSymUnloadModule64;
    PtrSymEnumSymbols m_pSymEnumSymbols;
    PtrSymGetModuleInfo64 m_pSymGetModuleInfo64;
    PtrSymGetTypeInfo m_pSymGetTypeInfo;
};

// ----------------------------------------------------------------------------

}   // namespace DSymLoad

// ----------------------------------------------------------------------------
